<%= error_messages_for 'book' %>

<!--[form:book]-->
<p><label for="book_title">Title</label><br/>
<%= text_field 'book', 'title'  %></p>

<p><label for="book_original_title">Original title</label><br/>
<%= text_field 'book', 'original_title'  %></p>

<p><label for="book_isbn">ISBN</label><br/>
<%= text_field 'book', 'isbn'  %></p> 

<p><label for="book_language">Language</label><br/>
<%= collection_select("book", "language_id", @languages, :id, :description) %></p>

<p><label for="book_publisher">Publisher</label><br/>
<%= collection_select("book", "publisher_id", @publishers, :id, :description) %></p>

<p><label for="book_author">Authors</label>
<input type="button" value="Add author" onclick="addAuthor();"/>
<br/>
<div id="authors">
<% for author in @book.authors %>
<select id="book_author" name="book[author][]">
<%= options_from_collection_for_select(@authors, :id, :full_name, author.id) %>
</select> <br/>
<% end %>
</div>

<div id="hiddenAuthor" style="display: none;">
<select id="book_author" name="book[author][]">
<%= options_from_collection_for_select(@authors, :id, :full_name) %>
</select>
<input type="button" value="Remove" onclick="removeAuthor(this.parentNode);"/>
<br/>
</div>

</p>
<!--[eoform:book]-->